package service.configuration.xstream;

import java.util.List;

import service.configuration.IBlockConfig;
import service.configuration.ISheetConfig;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

@XStreamAlias("sheet")
public class SheetConfig implements ISheetConfig {
	@XStreamAlias("type")
	@XStreamAsAttribute()
	private String name;
	private String table;
	private String label;
	private String code;
	private String version;
	
	@XStreamImplicit(itemFieldName="block", keyFieldName="block")
	private List<IBlockConfig> blocks;
	

	public SheetConfig(String name, String table, String label, String code, 
			List<IBlockConfig> blocks) {
		this.name = name;
		this.table = table;
		this.code = code;
		this.blocks = blocks;
		this.label = label;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public String getTable() {
		return table;
	}
	public void setTable(String table) {
		this.table = table;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public List<IBlockConfig> getBlockConfigs() {
		return blocks;
	}
	public void setBlockConfigs(List<IBlockConfig> blocks) {
		this.blocks = blocks;
	}
	public void addBlockConfig(IBlockConfig block) {
		this.blocks.add(block);
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}
}
